cmake_minimum_required(VERSION 3.13)
project(flexe CXX)

set(CMAKE_CXX_STANDARD 17)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

set(PROJECT_SRC
    src/empty.cpp
    src/core/entity/flexe_group/flexe_group.cpp
    src/fg/fgcard/fgcard.c
    src/fg/fgchip/fgchip.c
    src/fg/fgpipe/fgpipe.c
    src/fg/fgdrv/fgdrv_memory.c
    src/fg/fgdrv/fgdrv.c
    src/infra/event/broker.cpp
    src/infra/event/listener.cpp
    src/infra/event/ievent.cpp
    src/infra/event/topic.cpp
    src/infra/error.cpp
    src/infra/hash.cpp
    src/infra/thread.cpp)

add_library(${PROJECT_NAME} SHARED ${PROJECT_SRC})

target_compile_definitions(${PROJECT_NAME} PRIVATE LIBFLEXE_ENDIAN_LE)
target_include_directories(${PROJECT_NAME} PRIVATE include)
target_link_libraries(${PROJECT_NAME} PUBLIC Threads::Threads)

add_subdirectory(test)
